import {createStore} from "vuex";

const store = createStore({
  state: function () {
    return {
      user: undefined,
      token: undefined
    }
  },
  getters: {
    getToken(state) {
      return state.token;
    }
  },
  mutations: {
    SET_TOKEN(state, token) {
      state.token = token;
    }
  },
  actions: {
    setToken({commit}, token) {
      commit('SET_TOKEN', token)
    }
  }
})

export default store;